package com.shuyun.function;

import java.util.function.Supplier;

/**
 * @description:
 * @author: shuai.chen@shuyun.com
 * @date: 2021/9/10 9:40 上午
 */
public class SupplierDemo {

    public static void main(String[] args) {
        Supplier<String> stringSupplier = () -> "hello world";
        System.out.println(stringSupplier.get());


        // 此时并不会调用Person的构造方法
        Supplier<Person> personSupplier = Person::new;

        // 调Person的无参构造
        personSupplier.get();

        personSupplier.get();


        System.out.println(aa(()->"hello world"));


    }

    public static String aa(Supplier<String> stringSupplier) {
        return stringSupplier.get();
    }

}


